using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Windows.Forms;

namespace SdmxMl.UC
{
	/// <summary>
	/// DualListDesigner is the Designer for the DualListComponent. 
	/// </summary>
	/// <remarks>
	/// It shadows the Button, ListBoxFrom and ListBoxTo properties. This to
	/// prevent event handling from these controls in the Designer.
	/// </remarks>
	public class DualListDesigner : System.ComponentModel.Design.ComponentDesigner
	{
		/// <summary>
		/// Button to shadow.
		/// </summary>
		public virtual Button Button
		{
			get { return (Button)ShadowProperties["Button"]; }
			set 
			{ 
				// note this value is not passed to the actual component
				this.ShadowProperties["Button"] = value;
			}
		}

		/// <summary>
		/// ListBox from.
		/// </summary>
		public virtual ListBox ListBoxFrom
		{
			get { return (ListBox)ShadowProperties["ListBoxFrom"]; }
			set 
			{ 
				// note this value is not passed to the actual component
				this.ShadowProperties["ListBoxFrom"] = value;
			}
		}

		/// <summary>
		/// ListBox to.
		/// </summary>
		public virtual ListBox ListBoxTo
		{
			get { return (ListBox)ShadowProperties["ListBoxTo"]; }
			set 
			{ 
				// note this value is not passed to the actual component
				this.ShadowProperties["ListBoxTo"] = value;
			}
		}

		/// <summary>
		/// Do a prefilter of all properties.
		/// </summary>
		/// <param name="properties">the properties dictionary</param>
		protected override void PreFilterProperties(IDictionary properties) 
		{
			base.PreFilterProperties(properties);
        
			// replace Button with our shadowed versions.
			properties["Button"] = TypeDescriptor.CreateProperty(
				typeof(DualListDesigner), 
				(PropertyDescriptor)properties["Button"], 
				new Attribute[0]);

			// replace ListBoxFrom with our shadowed versions.
			properties["ListBoxFrom"] = TypeDescriptor.CreateProperty(
				typeof(DualListDesigner), 
				(PropertyDescriptor)properties["ListBoxFrom"], 
				new Attribute[0]);

			// replace ListBoxTo with our shadowed versions.
			properties["ListBoxTo"] = TypeDescriptor.CreateProperty(
				typeof(DualListDesigner), 
				(PropertyDescriptor)properties["ListBoxTo"], 
				new Attribute[0]);

		}
    
	}
}
